var config = require('../../config.json');
var EasyMongo = require('./mongoStore').EasyMongo;

var mongoConnection = new EasyMongo(config.store.database);

function saveResult(conn) {
  return function (data) {
    data.scale = 0;
    conn.add('words', data, function (err) {
      if(err) {
        console.error(err);
        console.log('![---' + data.word + '---]');
      }
    });
  }
}

exports.mongoStore = saveResult(mongoConnection);
exports.mongoConn = mongoConnection;